---
title: 
- "Replication package for Karreth, Tir, Quinn, and Joshi (JPR)"
subtitle:
- "Civil War Mediation in the Shadow of IGOs: The Path to Comprehensive Peace Agreements"
author: 
- Johannes Karreth
- Jaroslav Tir
- Jason Quinn
- Madhav Joshi

date: 
- June 27, 2023

output:
  rmdformats::readthedown:
    highlight: default
    smart: false
---

This folder contains all data and code to reproduce the analyses in:

> Karreth, Johannes, Jaroslav Tir, Jason Quinn, and Madhav Joshi. Forthcoming. Civil War Mediation in the Shadow of IGOs: The Path to Comprehensive Peace Agreements." *Journal of Peace Research*. [doi:10.1177/...](https://doi.org/10.1177...)

This document makes reference to the supporting information (SI), which is part of this replication package and also posted at <http://www.jkarreth.net>. For any questions, please contact the corresponding author at <jkarreth@ursinus.edu>.

To reproduce the analyses presented in the article, please open and run the script `analyze_mediation.R`. 

# Software requirements

Please install R (version 4.3.0 or higher). A list of R packages used in this project is at the end of this file. One R package that is not on CRAN ("Zelig") is in the "Software" folder of the replication package and can be loaded from there.

# Data sources

All data used in the analyses are provided within the folder "Data" within the replication package. Data sources are discussed and cited in the article. **Please note that all variables from external sources are provided for replication purposes only. Use the original source to obtain the newest and authoritative version of each dataset.**

# Analysis 

The script `analyze_mediation.R` performs the following tasks:

- load the data for analysis
- conducting the analyses in the article and supporting information (`KTQJ_SI.pdf`)

This script creates the following tables and figures:

- Figure 1
- Table 1
- Figure 2
- All tables and figures in the supporting information

All tables and figures produced by these scripts are written to a folder named "Output", which is in the replication package but empty until the script is run. 

# Software version information

All analyses using R were executed on version 4.3.0; a list of packages and versions used is at the end of this file. 

```
R version 4.3.0 (2023-04-21)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.4.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/New_York
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] lubridate_1.9.2        forcats_1.0.0          stringr_1.5.0          dplyr_1.1.2           
 [5] purrr_1.0.1            readr_2.1.4            tidyr_1.3.0            tibble_3.2.1          
 [9] ggplot2_3.4.2          tidyverse_2.0.0        survival_3.5-5         MAMI_0.9.13           
[13] estimatr_1.0.0         GJRM_0.2-6.3           mgcv_1.8-42            nlme_3.1-162          
[17] ggridges_0.5.4         viridis_0.6.3          viridisLite_0.4.2      xtable_1.8-4          
[21] marginaleffects_0.11.2 modelsummary_1.4.0     texreg_1.38.6         

loaded via a namespace (and not attached):
  [1] VineCopula_2.4.5        BMA_3.18.17             countrycode_1.4.0       splines_4.3.0          
  [5] later_1.3.1             cellranger_1.1.0        datawizard_0.7.1        lifecycle_1.0.3        
  [9] doParallel_1.0.17       globals_0.16.2          lattice_0.21-8          MASS_7.3-60            
 [13] insight_0.19.1          backports_1.4.1         survey_4.2-1            magrittr_2.0.3         
 [17] openxlsx_4.2.5.2        rmarkdown_2.21          yaml_2.3.7              httpuv_1.6.11          
 [21] zip_2.3.0               askpass_1.1             cowplot_1.1.1           DBI_1.1.3              
 [25] minqa_1.2.5             ADGofTest_0.3           abind_1.4-5             sfsmisc_1.1-15         
 [29] rvest_1.0.3             quadprog_1.5-8          pspline_1.0-19          nnet_7.3-18            
 [33] sandwich_3.0-2          gdtools_0.3.3           inline_0.3.19           listenv_0.9.0          
 [37] crul_1.3                performance_0.10.3      MatrixModels_0.5-1      parallelly_1.35.0      
 [41] svglite_2.1.1           codetools_0.2-19        MuMIn_1.47.6            DT_0.27                
 [45] xml2_1.3.4              tidyselect_1.2.0        shape_1.4.6             farver_2.1.1           
 [49] httpcode_0.3.0          effectsize_0.8.3        gmp_0.7-1               lme4_1.1-33            
 [53] matrixStats_0.63.0      stats4_4.3.0            webshot_0.5.4           jsonlite_1.8.4         
 [57] ellipsis_0.3.2          Formula_1.2-5           iterators_1.0.14        emmeans_1.8.6          
 [61] systemfonts_1.0.4       Zelig_5.1.7             foreach_1.5.2           tools_4.3.0            
 [65] startupmsg_0.9.6        miscTools_0.6-28        ragg_1.2.5              snow_0.4-4             
 [69] rio_0.5.29              Rcpp_1.0.10             glue_1.6.2              distrEx_2.9.0          
 [73] mnormt_2.1.1            gridExtra_2.3           xfun_0.39               ggthemes_4.2.4         
 [77] withr_2.5.0             numDeriv_2016.8-1.1     scam_1.2-14             fastmap_1.1.1          
 [81] mitools_2.4             boot_1.3-28.1           fansi_1.0.4             SparseM_1.81           
 [85] openssl_2.0.6           digest_0.6.31           timechange_0.2.0        R6_2.5.1               
 [89] mime_0.12               estimability_1.4.1      textshaping_0.3.6       colorspace_2.1-0       
 [93] copula_1.1-2            utf8_1.2.3              generics_0.1.3          fontLiberation_0.1.0   
 [97] Amelia_1.8.1            data.table_1.14.8       robustbase_0.95-1       httr_1.4.6             
[101] htmlwidgets_1.6.2       parameters_0.21.0       pkgconfig_2.0.3         gtable_0.3.3           
[105] Rmpfr_0.9-2             lmtest_0.9-40           pcaPP_2.0-3             htmltools_0.5.5        
[109] coreSim_0.2.4           fontBitstreamVera_0.1.1 carData_3.0-5           MCMCpack_1.6-3         
[113] scales_1.2.1            kableExtra_1.3.4        leaps_3.1               ismev_1.42             
[117] knitr_1.42              rstudioapi_0.14         reshape2_1.4.4          tzdb_0.4.0             
[121] uuid_1.1-0              checkmate_2.2.0         coda_0.19-4             magic_1.6-1            
[125] curl_5.0.0              nloptr_2.0.3            zoo_1.8-12              flextable_0.9.1        
[129] AER_1.2-10              parallel_4.3.0          foreign_0.8-84          pillar_1.9.0           
[133] grid_4.3.0              vctrs_0.6.2             VGAM_1.1-8              promises_1.2.0.1       
[137] car_3.1-2               maxLik_1.5-2            gamlss.dist_6.0-5       evaluate_0.21          
[141] mvtnorm_1.1-3           cli_3.6.1               compiler_4.3.0          rlang_1.1.1            
[145] crayon_1.5.2            MatchIt_4.5.4           future.apply_1.11.0     rrcov_1.7-2            
[149] labeling_0.4.2          plyr_1.8.8              stringi_1.7.12          psych_2.3.3            
[153] tables_0.9.17           munsell_0.5.0           gsl_2.1-8               effects_4.2-2          
[157] geepack_1.3.9           glmnet_4.1-7            bayestestR_0.13.1       quantreg_5.95          
[161] fontquiver_0.2.1        Matrix_1.5-4            pltesim_1.0             stabledist_0.7-1       
[165] hms_1.1.3               future_1.32.0           gfonts_0.2.0            mcmc_0.9-7             
[169] shiny_1.7.4             haven_2.5.2             evd_2.3-6.1             trust_0.1-8            
[173] gt_0.9.0                broom_1.0.4             DEoptimR_1.0-13         distr_2.9.2            
[177] readxl_1.4.2            officer_0.6.2    
```
